<template>
  <div class="preview-container">
    <div class="start-btn">
      <!-- <el-button  @click="startExam">开始考试</el-button> -->
      <el-button @click="showRole">开始考试</el-button>
    </div>
    <div class="role-exam">
      <div class="btn">
        <el-button
          @click="() => this.$router.push({ name: 'ListQuick' })"
          icon="el-icon-arrow-left"
        >
        </el-button>
        <el-button
          @click="showRole"
          icon="el-icon-arrow-right"
          style="float: right"
        ></el-button>
      </div>
    </div>

    <div class="role-exam" v-if="roleExam">
      <img :src="imageArr[index]" alt="" />
      <!-- <el-card style="width: 97.8%;position: fixed; bottom: 10px; opacity: 0.3;">
          <el-button type="primary" @click="()=>this.$router.go(-1)" icon="el-icon-arrow-left">
          </el-button>
          <el-button type="primary" @click="startExam" icon="el-icon-arrow-right" style="float: right;">
          </el-button>
      </el-card> -->
      <div class="btn">
        <el-button @click="backExam" icon="el-icon-arrow-left"> </el-button>
        <el-button
          @click="startExam"
          icon="el-icon-arrow-right"
          style="float: right"
        >
        </el-button>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "PreviewRequired",
  data() {
    return {
      roleExam: false,
      imageArr: ["/images/bg/30.jpg", "/images/bg/31.jpg"],
      index: 0,
    };
  },
  methods: {
    showRole() {
      this.roleExam = true;
    },
    startExam() {
      this.roleExam = true;
      this.index++;
      if (this.index >= this.imageArr.length)
        this.$router.push({ name: "StartSafety" });
    },
    backExam() {
      if (!this.roleExam) {
        this.$router.go(-1);
        return;
      }
      this.roleExam = false;
    },
  },
};
</script>

<style scoped>
.preview-container {
  min-height: 100vh;
  /* background: linear-gradient(135deg, #f5f7fa 0%, #e4e7ed 100%); */
  background-image: url("/images/bg/29.jpg");
  background-position: center;
  background-repeat: no-repeat;

  background-size: cover;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  /* padding: 20px; */
}

::-webkit-scrollbar {
  display: none;
}

.start-btn {
  position: relative;
}

.start-btn .el-button {
  width: 480px;
  height: 180px;
  position: absolute;
  bottom: -365px;
  left: -240px;
  /* border-radius: 10%; */
  opacity: 0;
}

.role-exam {
  width: 100%;
  height: 100%;
  display: flex;
}

.role-exam img {
  width: 100%;
  height: 100%;
}

.btn {
  width: 99%;
  bottom: 20px;
  position: fixed;
  opacity: 0.3;
  margin: 0 10px;
}
</style>